from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from redis import StrictRedis
from flask_wtf import CSRFProtect
from flask_session import Session
# from config import DevelopmentConfig,ProductionConfig,TestConfig
from config import configs

db = SQLAlchemy()

def create_app(env):
    app = Flask(__name__)
    app.config.from_object(configs[env])
    db.init_app(app)
    redis_store = StrictRedis(host=configs[env].REDIS_HOST, port=configs[env].REDIS_PORT)
    CSRFProtect(app)
    Session(app)
    return app